﻿using System;
using EPiServer.DataAccess;
using TemplateFoundation.WebControls.PropertyControls;

namespace TemplateFoundation.Core
{
    /// <summary>
    /// Arguments for event occuring on an edit page
    /// </summary>
    /// <remarks>See <see cref="PropertyUserControlBase"/> PropertyLoad and PropertySave events</remarks>
    public class EditPageEventArgs : EventArgs
    {
        /// <summary>
        /// Creates a new arguments object for the specified save action
        /// </summary>
        /// <param name="saveAction">The action performed in edit mode triggering the postback</param>
        /// <param name="sender">The control triggering the postback</param>
        public EditPageEventArgs(object sender, SaveAction saveAction)
        {
            SaveAction = saveAction;
            Sender = sender;
        }

        /// <summary>
        /// Creates a new arguments object for the specified save action
        /// </summary>
        /// <param name="saveAction">The action performed in edit mode triggering the postback</param>
        public EditPageEventArgs(SaveAction saveAction) : this(null,saveAction)
        {

        }

        /// <summary>
        /// Gets the SaveAction that triggered the event
        /// </summary>
        public SaveAction SaveAction { get; protected set; }

        /// <summary>
        /// Gets the control that triggered the event
        /// </summary>
        public object Sender { get; protected set; }
    }
}
